package com.example.weixinapireptile.dingding;

import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiRobotSendRequest;
import com.dingtalk.api.response.OapiRobotSendResponse;
import com.taobao.api.ApiException;

public class DingDingBot {

    /**
     * 钉钉群聊机器人
     *
     * @param
     * @throws ApiException
     */
    public static  void sendBot() throws ApiException {
        DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=44d9221bee61fad989cbc5f148a9ad80e6724e861b1a0d4582c6ebabd0f65b56");
        OapiRobotSendRequest request = new OapiRobotSendRequest();
        request.setMsgtype("text");
        OapiRobotSendRequest.Text text = new OapiRobotSendRequest.Text();

        text.setContent("提醒!!!!!转发异常报警消息:接口调用频繁失效!!!请重新使用微信扫码登录公众平台!!!!!!\n");

        request.setText(text);
        OapiRobotSendResponse response = client.execute(request);

    }

    public static void main(String[] args) throws ApiException {
        DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=44d9221bee61fad989cbc5f148a9ad80e6724e861b1a0d4582c6ebabd0f65b56");
        OapiRobotSendRequest request = new OapiRobotSendRequest();
        request.setMsgtype("text");
        OapiRobotSendRequest.Text text = new OapiRobotSendRequest.Text();
        String monkey = "▓▓▓▓▓▓▓████████████▓▓▓▓▓▓▓\n" +
                "▓▓▓▓▓▄██████████████▄▓▓▓▓▓\n" +
                "▓▓▓▓██████████████████▓▓▓▓\n" +
                "▓▓▓▐███▀▀▀▀▀██▀▀▀▀▀███▌▓▓\n" +
                "▓▓▓▓██▓▓█★█▓▓▓▓█★█▓▓██▓▓\n" +
                "▓▓▓▓▓█▄▓▀▀▀▓▓▓▓▀▀▀▓▄█▓▓▓\n" +
                "▓▓▓▓▓▀██▓▓▄▄▓▓▄▄▓▓██▀▓▓\n" +
                "▓▓▓▓▓▓▓██▓▓▓▀▓▓▀▓▓▓██▓▓▓\n" +
                "▓▓▓▓▓▓▓███▓▓▓▓▓▓▓▓▓██▓▓\n" +
                "▓▓▓▓▓▓▓▓██▓▓▀▀▀▀▀▀▓██▓▓▓\n" +
                "▓▓▓▓▓▓▓▓██▄▓▓▓▓▓▓▄██▓▓▓▓▓\n" +
                "▓▓▓▓▓▓▓▓▓▀████████▀▓▓▓▓▓▓\n";
        text.setContent("提醒转发异常报警消息:接口调用频繁失效!!!请重新使用微信扫码登录公众平台!!!!!!\n" + monkey);

        request.setText(text);
        OapiRobotSendResponse response = client.execute(request);
    }
}
